﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FoneBuddy.LinqModel.Data;
using FoneBuddy.LinqData;
using FoneBuddy.LinqModel;

public partial class Os_List : System.Web.UI.Page
{
    IDataRepository _dataObject = new DataRepository();
    OperatingSystemInfo os;
    List<OperatingSystemInfo> oslist = new List<OperatingSystemInfo>();

    #region pageload
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            getOs();
    }
    #endregion



    #region delete
    protected void OnDelete(object sender, EventArgs e)
    {
        try
        {
            LinkButton lnk = sender as LinkButton;
            Int32 Id = Convert.ToInt32(lnk.CommandArgument);
            os = new OperatingSystemInfo(_dataObject);
            os.Id = Id;
            os.Delete();
            getOs();
        }
        catch (Exception ex)
        {

        }
    }

    #endregion

    #region getdata
    private void getOs()
    {
        os = new OperatingSystemInfo(_dataObject);

        oslist = os.GetAllOs();

        if (oslist != null)
        {
            rptOs.DataSource = oslist;
            rptOs.DataBind();
        }
        
    }
    #endregion
}